<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>日期</title>
</head>

<body>
    <?php
    /**
     * 日期
     */
    // date_default_timezone_set('Asia/Shanghai');
    echo "日期：", date("Y-m-d H:i"), "<br>";
    ?>

    <section>
        <h1>分析</h1>
        <ul>
            <li>Y：年</li>
            <li>m：月</li>
            <li>d：日</li>
            <li>H：小时</li>
            <li>i：分钟</li>
            <li><a href="https://www.runoob.com/php/php-date.html" target="_blank">更多参数查看</a></li>
        </ul>
    </section>


    <section>
        <h1>问题：时间少8个小时</h1>
        <ul>
            <li>方法1，代码前添加：date_default_timezone_set('Asia/Shanghai');</li>
            <li>方法2，修改配置文件：date.timezone = Asia/Shanghai，然后重启php</li>
            <li><a href="https://blog.csdn.net/hantut/article/details/84955420" target="_blank">参考</a></li>
        </ul>
    </section>


</body>

</html>